package com.prs.crm.action.stock.flow;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;

import com.prs.crm.action.FlowAction;
import com.prs.crm.annotation.Clew;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.purchase.PurchaseOrder;
import com.prs.crm.domain.stock.Purchase;
import com.prs.crm.domain.store.StoreIn;
import com.prs.crm.service.stock.StoreInService;


public class StoreInFlowAction extends FlowAction<StoreIn> {

	private StoreIn storein;

	@Autowired
	private StoreInService storeInService;
	
	private PaginationSupport pagination;

	
	
	
	@Action("listStoreInFlow")
	public String listStoreInFlow() {
		pagination = this.getPaginationHelper().prepare(pagination);
	pagination = this.getStoreInService().listFlowTask(StoreIn.class, pagination, AppContext.getAccountContext().currentUser());
		return SUCCESS;
	}
	
	@Action("editStoreInFlow")
	public String editStoreInFlow() {
		this.displayEndNodes();		
		return SUCCESS;
	}
	
	@Clew(results={"success"})
	@Action(value="submitStoreInFlow",results={@Result(name="success",type="redirect",location="listStoreInFlow")})
	public String submitStoreInFlow() {
		this.getStoreInService().execute(this.getNode(), this.getDetail(), storein, AppContext.getAccountContext().currentUser());
		this.setPrompt("提交成功");
		return SUCCESS;
	}	
	public StoreIn getStorein() {
		return storein;
	}

	public void setStorein(StoreIn storein) {
		this.storein = storein;
	}

	public StoreInService getStoreInService() {
		return storeInService;
	}

	public void setStoreInService(StoreInService storeInService) {
		this.storeInService = storeInService;
	}

	public PaginationSupport getPagination() {
		return pagination;
	}

	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	
	
	
	
	
}
